// package: learn-go
// filename: regx
// author: Administrator@gmail.com
// time: 2023/8/14 15:26
package main

import (
	"fmt"
	"regexp"
)

func main() {
	str := `
	 	18.17.0
	    * 16.17.0 (Currently using 64-bit executable)
	`
	// 获取 node 的版本
	regex := regexp.MustCompile(`\d+\.\d+\.\d+`)
	matches := regex.FindAllString(str, -1)

	for _, match := range matches {
		fmt.Println(match)
	}

	// 当前可用版本
	regexCur := regexp.MustCompile(`\*\s\d+\.\d+\.\d+`)
	matchesCur := regexCur.FindAllString(str, -1)
	fmt.Println(matchesCur)
}
